//
//  CSSearchCellContent.m
//  CarSalesMS_GCX
//
//  Created by Ssky on 2016/11/18.
//  Copyright © 2016年 Tony. All rights reserved.
//

#import "CSSearchCellContent.h"


@interface CSSearchCellContent ()

@property (nonatomic,weak) UILabel * lblIndex;
@property (nonatomic,weak) UILabel * lblUserName;
@property (nonatomic,weak) UILabel * lblBusinessman;
@property (nonatomic,weak) UILabel * lblTotalMoney;

@end

@implementation CSSearchCellContent


- (void)distributeWithDict:(NSDictionary *)dict {
    //@{@"orderIndex":orderIndex, @"userName":userName, @"businessman":businessman, @"totalMoney":totalMoney}
    
    self.lblIndex.text = [NSString stringWithFormat:@"%d", [dict[@"orderIndex"] intValue] + 1];
    self.lblUserName.text = dict[@"userName"];
    self.lblBusinessman.text = dict[@"businessman"];
    self.lblTotalMoney.text = [NSString stringWithFormat:@"%.2f", [dict[@"totalMoney"] floatValue]];
}


-(void)setupUI {
    //
    UILabel * lblIndex = [UILabel gx_labelWithText:@"行" fontSize:13 color:nil];
    [self addSubview:lblIndex];
    
    [lblIndex mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.bottom.equalTo(self);
        make.leading.equalTo(self).offset(5);
        make.width.offset(30);
    }];
    
    //
    UILabel * lblUserName = [UILabel gx_labelWithText:@"操作人" fontSize:13 color:nil];
    [self addSubview:lblUserName];
    
    [lblUserName mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.bottom.equalTo(lblIndex);
        make.leading.equalTo(lblIndex.mas_trailing);
        make.width.offset(80);
    }];
    
    //
    UILabel * lblBusinessman = [UILabel gx_labelWithText:@"客户" fontSize:13 color:nil];
    [self addSubview:lblBusinessman];
    
    [lblBusinessman mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.bottom.equalTo(lblIndex);
        make.leading.equalTo(lblUserName.mas_trailing);
    }];
    
    //
    UILabel * lblTotalMoney = [UILabel gx_labelWithText:@"金额" fontSize:13 color:nil];
    [self addSubview:lblTotalMoney];
    lblTotalMoney.textAlignment = NSTextAlignmentRight;
    
    [lblTotalMoney mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.bottom.equalTo(lblIndex);
        make.leading.equalTo(lblBusinessman.mas_trailing);
        make.trailing.equalTo(self).offset(-5);
        make.width.offset(100);
    }];
    
    //
    self.lblIndex = lblIndex;
    self.lblUserName = lblUserName;
    self.lblBusinessman = lblBusinessman;
    self.lblTotalMoney = lblTotalMoney;
}


- (void)setDataDictSearchCell:(NSDictionary *)dataDictSearchCell {
    _dataDictSearchCell = dataDictSearchCell;
    [self distributeWithDict:dataDictSearchCell];
}

- (CGFloat)vRowHeight {
    
//    CGFloat hei = [self systemLayoutSizeFittingSize:<#(CGSize)#>]
    return 0;
}


@end
